<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use ValiDate;
use App\Facades\Services\LoginService;

class LoginController extends Controller
{
    public function login(Request $request){

    	$rules = [
    		'username' => 'required',
    		'password' => 'required',
    		'remember' => 'required|boolean'
    	];

    	ValiDate::valiDate($request,$rules);

    	LoginService::toLogin($request->only(['username','password']),$request->remember);

    	return formatJsonResponse();
    }

    public function logout(){

    	LoginService::logout();

    	return formatJsonResponse();
    }
}
